#import "head.h"
#import "sprite_library_treasure_exhibition_dialog.h"

typedef struct STreasureWeaponObject_
{
	int id;
	CCSprite *holder;
	CCLabelTTF *name;
	CCSprite *icon;
	std::vector<CCLabelTTF *> description;
}
STreasureWeaponObject;

typedef struct STreasureItemObject_
{
	int id;
	CCSprite *holder;
	CCLabelTTF *name;
	CCSprite *icon;
	CCLabelTTF *count;
	std::vector<CCLabelTTF *> description;
}
STreasureItemObject;

typedef struct STreasureExhibitionObject_
{
	int id;
	CCSprite *holder;
	CCLabelTTF *name;
	CCSprite *icon;
	std::vector<CCLabelTTF *> description;
}
STreasureExhibitionObject;

/*layer_library_treasure
*/
@interface layer_library_treasure : CCLayer
{
	bool flagTouchLock_;
	bool flagFunctionLock_;
	bool flagTouchDragSelect_;
	int currentSelectTable_;
	int holderH_;

	CGPoint start_;
	CGPoint end_;
	CGPoint drag_;

	CCSprite *imageTableWeapon_;
	CCSprite *imageTableItem_;
	CCSprite *imageTableExhibition_;
	CCSprite *imageSelected_;

	UICenterRect tableWeaponRect_;
	UICenterRect tableItemRect_;
	UICenterRect tableExhibitionRect_;

	UICenterRect selectObjectRect_;
	UICenterRect selectDetailRect_;

	/*weapon
	*/
	int currentActiveWeaponIndex_;
	CCSprite *detailWeaponIcon_;
	std::vector<STreasureWeaponObject> weaponTable_;

	/*item
	*/
	int currentActiveItemIndex_;
	CCSprite *detailItemIcon_;
	std::vector<STreasureItemObject> itemTable_;

	/*exhibition
	*/
	int currentActiveExhibitionIndex_;
	CCSprite *detailExhibitionIcon_;
	std::vector<STreasureExhibitionObject> exhibitionTable_;
	sprite_library_treasure_exhibition_dialog *exhibitionDialog_;

	/*particle
	*/
	CCParticleSystem *particle1_;
	CCParticleSystem *particle2_;
}

@property (nonatomic, readwrite) bool flagTouchLock;
@property (nonatomic, readwrite) bool flagFunctionLock;

- (id)initLayerLibraryTreasure;
- (void)dealloc;
- (void)ccTouchesBegan:(NSSet *)Touch withEvent:(UIEvent *)Event;
- (void)ccTouchesMoved:(NSSet *)Touch withEvent:(UIEvent *)Event;
- (void)ccTouchesEnded:(NSSet *)Touch withEvent:(UIEvent *)Event;

- (void)DragMove:(float)Offset;
- (void)DragMoveEnd:(float)Offset;
- (int)GetSelectIndex;
- (void)UpdateSelect;

- (void)SelectTableWeapon;
- (void)SelectTableItem;
- (void)SelectTableExhibition;

- (void)TableWeaponVisible:(bool)flag;
- (void)TableItemVisible:(bool)flag;
- (void)TableExhibitionVisible:(bool)flag;

- (void)WeaponUpdateDescription;
- (void)ItemUpdateDescription;
- (void)ExhibitionUpdateDescription;

- (void)DestroyExhibitonView;

- (void)CallBackItemBack:(id)Sender;

@end